﻿Public Class KNHopDong
    Private dt As New Database_
    Private sql As String
    Public Function DSHD() As DataTable
        sql = "select * from HOPDONG"
        Dim data As DataTable = dt.execQuery(sql)
        Return data
    End Function
    Public Function SaveHD(ByVal data As DataTable) As Boolean
        sql = "select * from HOPDONG "
        Return dt.ExecUpdate(sql, data)
    End Function

    Public Function SaveHDCT(ByVal data As DataTable) As Boolean
        sql = "select * from CHITIETHOPDONG "
        Return dt.ExecUpdate(sql, data)
    End Function

    Public Function DSCTHD() As DataTable
        sql = "select * from CHITIETHOPDONG"
        Dim data As DataTable = dt.execQuery(sql)
        Return data
    End Function
    Public Function DKDSHD(ByVal str As String) As DataTable
        sql = "select * from HOPDONG h Where h.MaHD='" & str & "'"
        Dim data As DataTable = dt.execQuery(sql)
        Return data
    End Function
    Public Function MAnv_CTHD(ByVal hd As String) As DataTable
        sql = "select c.MaNV from CHITIETHOPDONG c where c.MaHD='" & hd & "'"
        Dim data As DataTable = dt.execQuery(sql)
        Return data
    End Function
    Public Function MaHD_CTHD(ByVal hd As String) As DataTable
        sql = "select c.MaHD from CHITIETHOPDONG c where c.MaNV='" & hd & "'"
        Dim data As DataTable = dt.execQuery(sql)
        Return data
    End Function
    Public Function LCB_HD(ByVal manv As String) As DataTable
        sql = "select h.LuongCB,h.PCap from CHITIETHOPDONG c, HOPDONG h where c.MaNV='" & manv & "' and h.MaHD=c.MaHD"
        Dim data As DataTable = dt.execQuery(sql)
        Return data
    End Function
End Class
